@import '../core/theming/palette';
@import '../core/theming/theming';
@import '../core/style/form-common';
@import '../core/typography/typography-utils';


@mixin mat-select-theme($theme) {
  $foreground: map-get($theme, foreground);
  $background: map-get($theme, background);
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);
  $warn: map-get($theme, warn);

  .mat-select-content, .mat-select-panel-done-animating {
    background: mat-color($background, card);
  }

  .mat-select-value {
    color: mat-color($foreground, text);
  }

  .mat-select-placeholder {
    color: _mat-control-placeholder-color($theme);
  }

  .mat-select-disabled .mat-select-value {
    color: mat-color($foreground, disabled-text);
  }

  .mat-select-arrow {
    color: mat-color($foreground, secondary-text);
  }

  .mat-select-panel {
    .mat-option.mat-selected:not(.mat-option-multiple) {
      background: mat-color($background, hover, 0.12);
    }
  }

  .mat-form-field {
    &.mat-focused {
      &.mat-primary .mat-select-arrow {
        color: mat-color($primary);
      }

      &.mat-accent .mat-select-arrow {
        color: mat-color($accent);
      }

      &.mat-warn .mat-select-arrow {
        color: mat-color($warn);
      }
    }

    .mat-select.mat-select-invalid .mat-select-arrow {
      color: mat-color($warn);
    }

    .mat-select.mat-select-disabled .mat-select-arrow {
      color: mat-color($foreground, disabled-text);
    }
  }
}

@mixin mat-select-typography($config) {
  // The unit-less line-height from the font config.
  $line-height: mat-line-height($config, input);

  .mat-select {
    font-family: mat-font-family($config);
  }

  .mat-select-trigger {
    height: $line-height * 1em;
  }
}
